//
//  BookTableViewCell.m
//  iBook
//
//  Created by wangjing on 14/12/5.
//  Copyright (c) 2014年 wikiflyer. All rights reserved.
//

#import "BookTableViewCell.h"

@implementation BookTableViewCell


#pragma mark 重写set方法，完成数据的赋值操作
-(void)setBookModel:(BookModel *)bookModel{
    _bookModel = bookModel;
    self.bookImage.image = [UIImage imageNamed:bookModel.bookImg];
    self.bookTitle.text = bookModel.bookTitle;
    self.bookAuthor.text = bookModel.bookAuthor;
}

+(instancetype)bookCellWithTableView:(UITableView *)tableView{
    static NSString *ID = @"bookCell";
    BookTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle]loadNibNamed:@"BookTableViewCell" owner:nil options:nil]firstObject];
    }
    
    return cell;
}


- (void)awakeFromNib {
    // Initialization code
}

//-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
//    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
//    if (self) {
//        self.bookImage = [[UIImageView alloc]init];
//        self.bookAuthor = [[UILabel alloc]init];
//    }
//    return self;
//}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
